<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>PZ_${accountSetNo!}_${accountSetName!}_${voucherPeriod!}_${voucherType!}_${voucherNo!}</title>
    <style>
        @page {
            size: 297mm 210mm;
            padding: 0 0px;
        }

        body {
            font-family: SimHei;
            font-size: 14px;

        }

        .head {
            margin-bottom: 10px;
        }

        .head span {
            margin-right: 20px;

        }


        .bottom {
            margin-bottom: 10px;
        }

        .bottom span {
            width: 25%;
        }

        table {
            /*border: 1px solid #40a9ff;*/
            text-align: center;
            padding: 0px;
            margin: 0px;
            margin-bottom: 10px;
            border-collapse:collapse;
        }

        table td {
            padding: 5px;
            border: 1px solid #40a9ff;
            line-height:20px;
        }

        table th {
            color: #555555;
            background-color: #F0F8FF;
            border: 1px solid #40a9ff;
            /*width: 40px;*/
            line-height: 24px;
        }

        .left-color {
            border-left: 1px solid red;
        }

        .right-color {
            border-right: 1px solid red;
        }

    </style>
</head>
<body>

<#assign size = 10>
<div class="head">
    <span>
        账套:${accountSetNo!}-${accountSetName!}
    </span>
    <span>
            类型:${voucherType!}
    </span>
    <span>
            凭证号: ${voucherNo!}
    </span>
    <span>
            会计区间: ${voucherPeriod!}
    </span>
    <span style="float: right;width: 120px;margin-right: 0px">
			日期:${(voucherDate?string("yyyy-MM-dd"))!}
    </span>
</div>

<table cellspacing="0" cellpadding="0" width="100%">
    <tr>
        <th colspan="3" rowspan="2" style="width: 80px">
            行次
        </th>
        <th colspan="7" rowspan="2" style="width: 90px">
            摘要
        </th>
        <th colspan="7" rowspan="2">
            科目编码
        </th>
        <th colspan="9" rowspan="2">
            科目名称
        </th>
        <th colspan="13">
            借方金额
        </th>
        <th colspan="13">
            贷方金额
        </th>

    </tr>

    <tr>
        <#list 1..2 as t>
            <th>
                百
            </th>
            <th>
                十
            </th>
            <th>
                亿
            </th>
            <th>
                千
            </th>
            <th>
                百
            </th>
            <th>
                十
            </th>
            <th>
                万
            </th>
            <th>
                千
            </th>
            <th>
                百
            </th>
            <th>
                十
            </th>
            <th class="right-color">
                元
            </th>
            <th class="left-color">
                角
            </th>
            <th>
                分
            </th>
        </#list>
    </tr>
    <#assign debitAmountTotal = 0.0>
    <#assign creditAmountTotal = 0.0>
    <#assign currency="CNY" >
    <#if lines?exists>
        <#assign page = (lines?size/size)?ceiling>

        <#list 1..page as c>
            <#if c*size gt lines?size>
                <#assign end = lines?size-1 />
            <#else>
                <#assign end = c*size-1 />
            </#if>
            <#list (c-1) * size..end as i>
                <#assign line = lines[i] />
                <#if line!=null>
                    <#if line.debitAmount?exists>
                        <#assign debitAmountTotal +=line.debitAmount >
                    </#if>
                    <#if line.creditAmount?exists>
                        <#assign creditAmountTotal +=line.creditAmount >
                    </#if>

                    <#assign currency=line.currency >
                    <tr>
                        <td colspan="3">
                            ${i+1}
                        </td>
                        <td colspan="7">
                            ${line.voucherAbstract?html}
                        </td>
                        <td colspan="7">
                            ${line.subjectCode!}
                        </td>
                        <td colspan="9">
                            ${line.subjectName!}
                        </td>
                        <#--        借方金额        -->
                        <#if (line.debitAmount)??>
                            <#assign debit = (line.debitAmount?string('0.00'))?split(".") />
                            <#list debit as m>
                                <#if m_index==0>
                                    <#list 10..0 as l>
                                        <#if l gt m?length-1>
                                            <td></td>
                                        <#else>
                                            <#if line.debitAmount == 0>
                                                <#if (line.creditAmount)?? &&  line.creditAmount != 0>
                                                    <td></td>
                                                <#else>
                                                    <td>0</td>
                                                </#if>
                                            <#else>
                                                <td>${m?substring(m?length-l-1,m?length-l)}</td>

                                            </#if>

                                        </#if>
                                    </#list>
                                </#if>
                                <#if debit?size==2>
                                    <#if m_index==1>
                                        <#list 1..0 as l>
                                            <#if l gt m?length-1>
                                                <td<#if l==0> class="left-color"</#if>></td>
                                            <#else >
                                                <#if line.debitAmount == 0>
                                                    <#if (line.creditAmount)?? &&  line.creditAmount != 0>
                                                        <td<#if l==1> class="left-color"</#if>></td>
                                                    <#else>
                                                        <td<#if l==1> class="left-color"</#if>>0</td>
                                                    </#if>
                                                <#else>
                                                    <td<#if l==1> class="left-color"</#if>>${m?substring(m?length-l-1,m?length-l)}</td>
                                                </#if>
                                            </#if>

                                        </#list>
                                    </#if>

                                <#else>
                                    <#list 1..0 as l>

                                        <td <#if l==0>class="left-color"</#if>></td>

                                    </#list>
                                </#if>
                            </#list>
                        <#else>
                            <#list 12..0 as l>
                                <td<#if l==1> class="left-color"</#if>></td>
                            </#list>

                        </#if>




                        <#--        贷方金额        -->
                        <#if (line.creditAmount)??>
                            <#assign credit = (line.creditAmount?string('0.00'))?split(".") />
                            <#list credit as m>
                                <#if m_index==0>
                                    <#list 10..0 as l>
                                        <#if l gt m?length-1>
                                            <td></td>
                                        <#else >

                                            <#if line.creditAmount == 0>
                                                <#if (line.debitAmount)?? &&  line.debitAmount != 0>
                                                    <td></td>
                                                <#else>
                                                    <td>0</td>
                                                </#if>
                                            <#else>
                                                <td>${m?substring(m?length-l-1,m?length-l)}</td>

                                            </#if>

                                        </#if>
                                    </#list>
                                </#if>
                                <#if credit?size==2>
                                    <#if m_index==1>
                                        <#list 1..0 as l>
                                            <#if l gt m?length-1>
                                                <td<#if l==0> class="left-color"</#if>></td>
                                            <#else >
                                                <#if line.creditAmount == 0>
                                                    <#if (line.debitAmount)?? &&  line.debitAmount != 0>
                                                        <td<#if l==1> class="left-color"</#if>></td>
                                                    <#else>
                                                        <td<#if l==1> class="left-color"</#if>>0</td>
                                                    </#if>
                                                <#else>
                                                    <td<#if l==1> class="left-color"</#if>>${m?substring(m?length-l-1,m?length-l)}</td>
                                                </#if>
                                            </#if>

                                        </#list>
                                    </#if>

                                <#else >
                                    <#list 1..0 as l>

                                        <td <#if l==1>class="left-color"</#if>></td>

                                    </#list>

                                </#if>
                            </#list>
                        <#else>
                            <#list 12..0 as l>
                                <td<#if l==1> class="left-color"</#if>></td>
                            </#list>
                        </#if>
                    </tr>
                </#if>
            </#list>
        <#-- 最后一页不换页 -->
            <#if c lt page>
            <#-- 换页标志 -->
                <div style="page-break-after:always;"></div>

            </#if>
        </#list>
    </#if>

    <tr style="background-color: #F0F8FF;">
        <td colspan="26" style="text-align: left">
            合计：${standardCurrency !}
        </td>
        <#--        借方金额合计        -->
        <#assign debitTotal = (debitAmountTotal?string('#.00'))?split(".") />
        <#list debitTotal as m>
            <#if m_index==0>
                <#list 10..0 as l>
                    <#if l gt m?length-1>
                        <td></td>
                    <#else >
                        <td>${m?substring(m?length-l-1,m?length-l)}</td>
                    </#if>
                </#list>
            </#if>
            <#if debitTotal?size==2>
                <#if m_index==1>
                    <#list 1..0 as l>
                        <#if l gt m?length-1 && debitAmountTotal == 0>
                            <td<#if l==1> class="left-color"</#if>></td>
                        <#else >

                            <td<#if l==1> class="left-color"</#if>>${m?substring(m?length-l-1,m?length-l)}</td>
                        </#if>

                    </#list>
                </#if>

            <#else >
                <#list 1..0 as l>

                    <td <#if l==1> class="left-color"</#if>></td>

                </#list>

            </#if>
        </#list>
        <#--        贷方金额合计        -->
        <#assign creditTotal = (creditAmountTotal?string('#.00'))?split(".") />
        <#list creditTotal as m>
            <#if m_index==0>
                <#list 10..0 as l>
                    <#if l gt m?length-1>
                        <td></td>
                    <#else >
                        <td>${m?substring(m?length-l-1,m?length-l)}</td>
                    </#if>
                </#list>
            </#if>
            <#if creditTotal?size==2>
                <#if m_index==1>
                    <#list 1..0 as l>
                        <#if l gt m?length-1 && creditAmountTotal == 0>
                            <td <#if l==1>class="left-color"</#if>></td>
                        <#else >
                            <td <#if l==1>class="left-color"</#if>>${m?substring(m?length-l-1,m?length-l)}</td>
                        </#if>

                    </#list>
                </#if>

            <#else >
                <#list 1..0 as l>

                    <td <#if l==1>class="left-color"</#if>></td>

                </#list>

            </#if>
        </#list>
    </tr>
</table>

<div style="">
    <table border="0" cellspacing="0" cellpadding="0" width="100%" style="word-break:keep-all;table-layout:fixed;text-align: left;">
        <tr>
            <td width="25%" style="border: 0px;">
                <#if (title.preparedBy)??>
                    ${title.preparedBy}:${preparedBy!}
                <#else>
                    制单人：${preparedBy!}
                </#if>
            </td>
            <td width="25%" style="border: 0px;">
                <#if (title.approvedBy)??>
                    ${title.approvedBy}:${approvedBy!}
                <#else>
                    核准人: ${approvedBy!}
                </#if>
            </td>
            <td width="25%" style="border: 0px;">
                <#if (title.operator)??>
                    ${title.operator}:${operator!}
                <#else>
                    经办人:${operator!}

                </#if>
            </td>
            <td width="25%" style="border: 0px;">
                <#if (title.reviewer)??>
                    ${title.reviewer}:${reviewer!}
                <#else>
                    审核人:${reviewer!}
                </#if>
            </td>
        </tr>
    </table>
</div>
</body>
</html>
